<template>
  <div>
    <h1>count:{{count}}</h1>
    <button @click="add">累加</button>
    <button @click="byebye">baibai</button>
  </div>
</template>

<script>
import PubSub from "pubsub-js";
export default {
    name : 'Gege',
    data(){
        return {
            count: 0
        }
    },
    methods: {
        add(){
            this.count++
          PubSub.publish("count", this.count);   
        },
        byebye(){
            PubSub.unsubscribe("count");
        }
    }
}
</script>

<style>

</style>